<?php
class Login_Model_Logged {
	
	private $validation;
	private $session;
	private $secure;
	
	public function __construct(){
		$this->validation = new Core_Model_Validation();
		$this->session = new Core_Model_Sessions();
		$this->secure = new Core_Data_Secure();
	}
	
	public function getSessionValues(array $postVars){
		if($this->validation->validation($postVars)){
			$article['sessionValues'] = $this->getData($postVars);
			if($article['sessionValues']['users_access_level'] < 1){
				echo '<meta http-equiv="Refresh" content="0;url='.SERVER_ROOT.'?manageaccount">';
			}
			else {
				return $article;
			}
		}
		else {
			return $this->session->checkUser($postVars);
		}
	}
	
	private function getData(array $postVars){
		$postVars = $this->secure->parseData($postVars);
		return $this->session->checkUser($postVars);
	}
}